﻿using System;
using System.Collections.Generic;
using System.Text;

namespace FD.FileSyncServer.Core.Extensions
{
    /*
     * CreatedOn: 2018-05-15
     * CreatedBy: Jackie Lee(天宇遊龍)
     */
    public static class ObjExtension
    {
        public static bool IsNullOrEmpty(this string str)
        {
            return string.IsNullOrEmpty(str) || str.Trim().Length == 0;
        }

        public static bool IgnoreCaseEquals(this string source, string target)
        {
            if (source.IsNullOrEmpty() || target.IsNullOrEmpty())
                return false;
            return source.Equals(target, StringComparison.OrdinalIgnoreCase);
        }

        public static bool IgnoreCaseContains(this string source, string item)
        {
            if (item.IsNullOrEmpty())
            {
                return false;
            }
            return source.IndexOf(item, StringComparison.OrdinalIgnoreCase) != -1;
        }
    }
}
